package july.framework.exsolver.factory.impl;

import july.framework.exsolver.bean.Resolver;
import july.framework.exsolver.bean.impl.LineResolver;
import july.framework.exsolver.bean.impl.MultiResolver;
import july.framework.exsolver.factory.ResolverFactory;
import org.springframework.util.StringUtils;

public class DefaultResolverFactory implements ResolverFactory {

    @Override
    public Resolver getResolver(String type) {

        if (StringUtils.isEmpty(type)){
            return null;
        }

        Resolver resolver = null;
        switch (type){
            case "line" :
                resolver = new LineResolver();
                break;
            case "multi" :
                resolver = new MultiResolver();
                break;
            default:
                break;
        }

        return resolver;
    }
}
